<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  
  <div id="components-demo">
    <blog-post title="我的 Vue 旅程"></blog-post>
    <blog-post title="用 Vue 写博客"></blog-post>
    <blog-post title="Vue 如此有趣"></blog-post>

    <hr>

    <blog-post
      v-for="post in posts"
      v-bind:key="post.id"
      v-bind:title="post.title"
    ></blog-post>
  </div>
  
  <script src="./js/vue.js"></script>
  <script>
    Vue.component('blog-post', {
      props: ['title'],
      template: '<h3>{{ title }}</h3>'
    })

    new Vue({ 
      el: '#components-demo',
      data: {
        posts: [
          { id: 1, title: '我的 Vue 旅程222' },
          { id: 2, title: '用 Vue 写博客222' },
          { id: 3, title: 'Vue 如此有趣222' }
        ]
      }
    })
  </script>
</body>
</html>